Read [for xml auto, elements] into DataTable in ADO.NET

Posted by ihorko on Stack Overflow See other posts from Stack Overflow or by ihorko
Published on 2010-11-21T20:20:22Z Indexed on 2010/12/21 15:54 UTC
Read the original article Hit count: 146

Filed under:
|
|
|
|

Hello All!

I have MS SQL Server stored procedure that returns XML (it uses SELECT with for xml auto, elements)

I tried read it into DataTable:

            DataTable retTable = new DataTable();
            SqlCommand comm = new SqlCommand("exec MySP", connection);
            SqlDataAdapter da = new SqlDataAdapter(comm);
            connection.Open();
            da.Fill(retTable); 

but retTable contains 12 rows with separated full xml thar SQL Server returns.

How can I read that XML from DB into DataTable object? Thanks!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql-server